const demo = require(process.argv[2])
console.log('running', demo)
console.log(demo.is_promise())
demo.wait().then(val => {
    console.log("then", val)
}).catch(val => {
    console.log("catch", val)
}).finally(() => {
    demo.wait().then(val => {
        console.log("then", val)
    }).catch(val => {
        console.log("catch", val)
    })
    console.log("rejecting")
    demo.reject()
    console.log("rejected")
})
console.log(demo.is_promise())
console.log("resolving")
demo.resolve()
console.log("resolved")

/*
running {
  wait: [Function (anonymous)],
  resolve: [Function (anonymous)],
  reject: [Function (anonymous)],
  is_promise: [Function (anonymous)]
}
false
false // (ture need long-life-time-object)
resolving
resolved
then 123
rejecting
rejected
catch 456
*/
